package com.example.demo.enums;

import lombok.Getter;

@Getter
public enum PayStateEnum {
    UNPAID(0, "未支付"),
    PAID(1, "已支付"),
    REFUND(2, "已退款"),
    WAIT_PAY(3, "待支付");

    private final int code;
    private final String value;

    PayStateEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }



    /**
     * 根据 value 获取枚举
     *
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static PayStateEnum getByValue(int value) {
        for (PayStateEnum payStateEnum : PayStateEnum.values()) {
            if (payStateEnum.code == value) {
                return payStateEnum;
            }
        }
        return null;
    }



}
